From: Aaron Schulz Date: Tue, 31 Mar 2015 04:00:13 +0000 (-0700) Subject: Fixed {{REVISION(TIMESTAMP|USER|SIZE)}} on new revisions X-Git-Tag: 1.31.0-rc.0~11921^2 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=ac0de3c4307877c2c45a96b783cf512d8b9bde06;p=lhc%2Fweb%2Fwiklou.git Fixed {{REVISION(TIMESTAMP|USER|SIZE)}} on new revisions * This makes use of the injected new revision object used elsewhere in Parser to solve this problem. Bug: T94407 Change-Id: I7881583cf7cb2bc799c89ffaa2a344a2d4ca3a4e --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 2f443c0164..40b0a4f459 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -5983,7 +5983,19 @@ class Parser { return null; } - $this->mRevisionObject = Revision::newFromId( $this->mRevisionId ); + $rev = call_user_func( + $this->mOptions->getCurrentRevisionCallback(), $this->getTitle(), $this + ); + + # If the parse is for a new revision, then the callback should have + # already been set to force the object and should match mRevisionId. + # If not, try to fetch by mRevisionId for sanity. + if ( $rev && $rev->getId() != $this->mRevisionId ) { + $rev = Revision::newFromId( $this->mRevisionId ); + } + + $this->mRevisionObject = $rev; + return $this->mRevisionObject; } @@ -5994,7 +6006,6 @@ class Parser { */ public function getRevisionTimestamp() { if ( is_null( $this->mRevisionTimestamp ) ) { - global $wgContLang; $revObject = $this->getRevisionObject();